package edu.sctu.zcy.month201505.subwaysystem.V2;

import java.util.List;

/**
 * Created by user24 on 2015/6/2.
 */
public class MonitoringSystem {

    List<Passenger> passengerList = new SetPassenger().setPassengerInfo();

    public String subweyAlert = "偷";
    public boolean is_Thief;

    public boolean alert(int i){

        if (passengerList.get(i).getAction().contains(subweyAlert)) {

            is_Thief = true;
        }
        else {
            is_Thief = false;
        }
        return is_Thief;
    }

    public void callThePolice() {

        for (int i = 0; i < passengerList.size(); i++) {

            if (alert(i)) {

                System.out.println("警报，有小偷出现");
                System.out.println("小偷名字为:"+passengerList.get(i).getName()+"\n小偷此时行为为：" + passengerList.get(i).getAction());
            } else {
                System.out.println("乘客"+passengerList.get(i).getName()+"正常");
            }

        }
    }
}

